<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "{{%solution}}".
 *
 * @property integer $id
 * @property string $name
 * @property integer $type
 * @property integer $advertiser_id
 * @property integer $ad_network_id
 * @property integer $campaign_id
 * @property string $start_date
 * @property string $end_date
 * @property string $weekday_slot
 * @property integer $budget_flag
 * @property string $budget
 * @property integer $is_pmp
 * @property string $pmp_price
 * @property integer $pmp_guid
 * @property integer $bid_type
 * @property string $fix_bid_price
 * @property string $optimize_bid_cpc
 * @property string $optimize_bid_cpm
 * @property string $optimize_ctr_target
 * @property string $optimize_ctr_cpm
 * @property integer $solution_mode
 * @property integer $ratio
 * @property string $frequency_ctrl
 * @property integer $adspace_type
 * @property integer $solution_audit
 * @property string $old_budget
 * @property integer $status
 * @property integer $creator
 * @property string $creator_name
 * @property string $last_update
 */
class Solution extends \app\models\BaseAR
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%solution}}';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['name', 'campaign_id', 'start_date'], 'required'],
            [['type', 'advertiser_id', 'ad_network_id', 'campaign_id', 'budget_flag', 'is_pmp', 'pmp_guid', 'bid_type', 'solution_mode', 'ratio', 'adspace_type', 'solution_audit', 'status', 'creator'], 'integer'],
            [['start_date', 'end_date', 'last_update'], 'safe'],
            [['budget', 'pmp_price', 'fix_bid_price', 'optimize_bid_cpc', 'optimize_bid_cpm', 'optimize_ctr_target', 'optimize_ctr_cpm', 'old_budget'], 'number'],
            [['name', 'frequency_ctrl'], 'string', 'max' => 128],
            [['weekday_slot'], 'string', 'max' => 13],
            [['creator_name'], 'string', 'max' => 64],
            [['advertiser_id', 'name'], 'unique', 'targetAttribute' => ['advertiser_id', 'name'], 'message' => 'The combination of Name and Advertiser ID has already been taken.']
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'name' => 'Name',
            'type' => 'Type',
            'advertiser_id' => 'Advertiser ID',
            'ad_network_id' => 'Ad Network ID',
            'campaign_id' => 'Campaign ID',
            'start_date' => 'Start Date',
            'end_date' => 'End Date',
            'weekday_slot' => 'Weekday Slot',
            'budget_flag' => 'Budget Flag',
            'budget' => 'Budget',
            'is_pmp' => 'Is Pmp',
            'pmp_price' => 'Pmp Price',
            'pmp_guid' => 'Pmp Guid',
            'bid_type' => 'Bid Type',
            'fix_bid_price' => 'Fix Bid Price',
            'optimize_bid_cpc' => 'Optimize Bid Cpc',
            'optimize_bid_cpm' => 'Optimize Bid Cpm',
            'optimize_ctr_target' => 'Optimize Ctr Target',
            'optimize_ctr_cpm' => 'Optimize Ctr Cpm',
            'solution_mode' => 'Solution Mode',
            'ratio' => 'Ratio',
            'frequency_ctrl' => 'Frequency Ctrl',
            'adspace_type' => 'Adspace Type',
            'solution_audit' => 'Solution Audit',
            'old_budget' => 'Old Budget',
            'status' => 'Status',
            'creator' => 'Creator',
            'creator_name' => 'Creator Name',
            'last_update' => 'Last Update',
        ];
    }
}
